package com.walkline.util.network;

import com.walkline.util.ui.StatusListStyleButtonField;
import com.walkline.weibo.WeiboSDK;

/**
 * 下载微博头像图片
 */
public class DownloadStatusAvatarImages implements Runnable
{
	private WeiboSDK _weibo;
	private StatusListStyleButtonField _item;

	public DownloadStatusAvatarImages(WeiboSDK weibo, StatusListStyleButtonField item)
	{
		_weibo = weibo;
		_item = item;
	}

	public void run()
	{
		if (_item.getAvatarUrl().equals("")) {return;}

		byte[] data = _weibo.doRequestRAW(_item.getAvatarUrl());

		if (data != null)
		{
			_item.getUser().setAvatarIconData(data);
			_item.setAvatarIcon(data);
		}
	}
}